﻿using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;

namespace HX.HxDemo.BOS.Business.PlugIn25011603
{
    [Description("【表单插件】AfterDeleteEntry"),HotUpdate]
    public class AfterDeleteEntryFormPlugIn : AbstractDynamicFormPlugIn
    {
        public override void EntryBarItemClick(BarItemClickEventArgs e)
        {
            base.EntryBarItemClick(e);
            if (e.BarItemKey.EqualsIgnoreCase("MDCE_tbButton"))
            {
                //删除分录全部数据行
                this.Model.DeleteEntryData("FPOOrderEntry");
            }
        }

        public override void AfterDeleteEntry(AfterDeleteEntryEventArgs e)
        {
            base.AfterDeleteEntry(e);
            if (e.EntityKey.EqualsIgnoreCase("FPOOrderEntry"))
            {
                //分录行全部删除后，锁定单据头字段
                this.View.GetControl("FSupplierId").Enabled = false;
                this.View.GetControl("FPurchaseOrgId").Enabled = false;
                this.View.GetControl("FPurchaseDeptId").Enabled = false;
                this.View.GetControl("FPurchaserGroupId").Enabled = false;
                this.View.GetControl("FACCTYPE").Enabled = false;
                this.View.ShowMessage("明细信息单据体的数据行已全部删除！");
            }
        }
    }
}
